
/**
  ******************************************************************************
  * Copyright 2021 The Microbee Authors. All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  * http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * 
  * @file       sensor_rf_benewake_tfmini.c
  * @author     baiyang
  * @date       2023-2-10
  ******************************************************************************
  */

/*----------------------------------include-----------------------------------*/
#include "sensor_rf_benewake_tfmini.h"
/*-----------------------------------macro------------------------------------*/
#if MB_RANGEFINDER_BENEWAKE_TFMINI_ENABLED
/*----------------------------------typedef-----------------------------------*/

/*---------------------------------prototype----------------------------------*/
static float model_dist_max_cm(sensor_rf_backend_const_t rf_backend);
/*----------------------------------variable----------------------------------*/
static struct sensor_rf_benewake_ops rf_benewake_ops = {.model_dist_max_cm = model_dist_max_cm,
                                                        .has_signal_byte = NULL};
/*-------------------------------------os-------------------------------------*/

/*----------------------------------function----------------------------------*/
void sensor_rf_backend_benewake_tfmini_ctor(sensor_rf_benewake_tfmini_t rf_backend_benewake_tfmini,
                                    sensor_rf_state_t _state, sensor_rf_params_t _params)
{
    sensor_rf_backend_benewake_ctor(&rf_backend_benewake_tfmini->backend, &rf_benewake_ops, NULL, NULL, _state, _params, "tfmini");
}

sensor_rf_backend_t sensor_rf_backend_benewake_tfmini_create(sensor_rf_state_t _state, sensor_rf_params_t _params)
{
    if (!_state || !_params) {
        return NULL;
    }

    sensor_rf_benewake_tfmini_t rangefinder = (sensor_rf_benewake_tfmini_t)rt_malloc(sizeof(struct sensor_rf_benewake_tfmini));

    if (!rangefinder) {
        return NULL;
    }

    sensor_rf_backend_benewake_tfmini_ctor(rangefinder, _state, _params);

    return (sensor_rf_backend_t)rangefinder;
}

static float model_dist_max_cm(sensor_rf_backend_const_t rf_backend)
{
    return 1200;
}
/*------------------------------------test------------------------------------*/
#endif

